package com.base.hong.ui.login

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.base.hong.databinding.ActivityLoginBinding
import com.base.hong.ext.doubleClick
import com.base.hong.ext.showToast
import com.base.hong.ui.MainActivity
import com.base.hong.ui.base.BaseVMActivity
import com.base.hong.ui.login.viewmodel.LoginViewModel
import com.htt.base_library.util.startActivity

class LoginActivity : BaseVMActivity<LoginViewModel,ActivityLoginBinding>() {


    override fun setEventListener() {
        mViewBinding.btnLogin.doubleClick {
            showToast("登录成功")
            startActivity<MainActivity>()
           viewModel.getLogin(mViewBinding.editName.text.toString(),mViewBinding.editPassword.text.toString())
        }
    }

    override fun initData() {
        viewModel.mLoginData.observe(this){
            showToast("登录成功")
            startActivity<MainActivity>()
        }
    }
}